#include "Floor.h"

// default constructor
Floor::Floor() {}

// default deconstructor, make sure release is called
Floor::~Floor() { release(); }

// release all data safetly
void Floor::release()
{
}

// setup floor
void Floor::intialize(char * fileName)
{
	// setup a default test room
	for(int y = 0; y < FLOORSIZE; y++)
	{
		for(int x = 0; x < FLOORSIZE; x++)
		{
			// used later for graph
			int id = x + y * FLOORSIZE;
			// set all tiles to floor except edges
			if(x == 0 || x == FLOORSIZE-1 || y == 0 || y == FLOORSIZE-1)
				m_layout[y][x].initialize(V2DF(x*32,y*32),0);
			else
				m_layout[y][x].initialize(V2DF(x*32,y*32),1);
		}
	}
	// set flags to defaults
	m_visited = m_cleared = false;
}

// update all tiles
void Floor::update(float dT) {}

// render this floor
void Floor::render()
{
	// render each tile
	for(int y = 0; y < FLOORSIZE; y++)
	{
		for(int x = 0; x < FLOORSIZE; x++)
		{
			m_layout[y][x].render();
		}
	}
}

// check if this entity is colliding with any walls
bool Floor::WallCollision(Entity * entity)
{
	return false;
}

// get graphnode based on position
GraphNode * Floor::getNode(V2DF position) {  return 0; }

// get graphnode based on id
GraphNode * Floor::getNode(int id) { return 0; }